package com.cyh;

import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

public class MonoFromTest01 {

    public static void main(String[] args) {
        // 创建一个 Flux（Publisher 的子类）
        Flux<String> flux = Flux.just("Hello", "World");
        System.out.println(flux);

        // 从 Flux 中取第一个元素创建 Mono
        Mono<String> mono = Mono.from(flux);
        System.out.println(mono);

        mono.subscribe(System.out::println); // 输出: Hello
    }
}
